package extended

import (
	"JVM/Jvmgo/GoToJVM/instructions/base"
	"JVM/Jvmgo/GoToJVM/runtimeData"
)

/*
	跳转指令
*/
// 为null跳转
type IFNULL struct {
	base.BranchInstruction
}

// 不为null跳转
type IFNONNULL struct {
	base.BranchInstruction
}

func (self *IFNULL) Execute(frame *runtimeData.Frame) {
	ref := frame.OperandStack().PopRef()
	if ref == nil {
		base.Branch(frame, self.Offset)
	}
}

func (self *IFNONNULL) Execute(frame *runtimeData.Frame) {
	ref := frame.OperandStack().PopRef()
	if ref != nil {
		base.Branch(frame, self.Offset)
	}
}
